<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 7.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/ME.ico">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/ME.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/ME.ico">
  <link rel="mask-icon" href="/images/ME.ico" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"www.zhoubencheng.com","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":true,"style":"mac"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="1. 专有名词(Professional Shortcut)  ELEN: Element width，表示向量中一个元素的位宽 VLEN: 单个向量寄存器的位宽 VL: 当前操作的向量长度（向量中有几个元素） LMUL: vector length multiplier 向量寄存器组，用于将多个向量寄存器合并使用 SEW: selected element width">
<meta property="og:type" content="article">
<meta property="og:title" content="RISCV向量扩展">
<meta property="og:url" content="http://www.zhoubencheng.com/2024/08/06/RISCV%E5%90%91%E9%87%8F%E6%89%A9%E5%B1%95/index.html">
<meta property="og:site_name" content="Benson&#39;s blog">
<meta property="og:description" content="1. 专有名词(Professional Shortcut)  ELEN: Element width，表示向量中一个元素的位宽 VLEN: 单个向量寄存器的位宽 VL: 当前操作的向量长度（向量中有几个元素） LMUL: vector length multiplier 向量寄存器组，用于将多个向量寄存器合并使用 SEW: selected element width">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2024-08-06T05:34:46.000Z">
<meta property="article:modified_time" content="2024-08-22T14:09:14.560Z">
<meta property="article:author" content="Benson">
<meta property="article:tag" content="RISCV">
<meta property="article:tag" content="并行计算">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://www.zhoubencheng.com/2024/08/06/RISCV%E5%90%91%E9%87%8F%E6%89%A9%E5%B1%95/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>RISCV向量扩展 | Benson's blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>


<style>.github-emoji { position: relative; display: inline-block; width: 1.2em; min-height: 1.2em; overflow: hidden; vertical-align: top; color: transparent; }  .github-emoji > span { position: relative; z-index: 10; }  .github-emoji img, .github-emoji .fancybox { margin: 0 !important; padding: 0 !important; border: none !important; outline: none !important; text-decoration: none !important; user-select: none !important; cursor: auto !important; }  .github-emoji img { height: 1.2em !important; width: 1.2em !important; position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; user-select: none !important; cursor: auto !important; } .github-emoji-fallback { color: inherit; } .github-emoji-fallback img { opacity: 0 !important; }</style>
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Benson's blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">最好的安排</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

  <a href="https://github.com/ZhouBencheng" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.zhoubencheng.com/2024/08/06/RISCV%E5%90%91%E9%87%8F%E6%89%A9%E5%B1%95/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/ME.ico">
      <meta itemprop="name" content="Benson">
      <meta itemprop="description" content="Share my thoughts with you">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Benson's blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          RISCV向量扩展
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2024-08-06 13:34:46" itemprop="dateCreated datePublished" datetime="2024-08-06T13:34:46+08:00">2024-08-06</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2024-08-22 22:09:14" itemprop="dateModified" datetime="2024-08-22T22:09:14+08:00">2024-08-22</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/System/" itemprop="url" rel="index"><span itemprop="name">System</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="专有名词professional-shortcut">1. 专有名词(Professional
Shortcut)</h2>
<ul>
<li><code>ELEN</code>: Element width，表示向量中一个元素的位宽</li>
<li><code>VLEN</code>: 单个向量寄存器的位宽</li>
<li><code>VL</code>: 当前操作的向量长度（向量中有几个元素）</li>
<li><code>LMUL</code>: vector length multiplier
向量寄存器组，用于将多个向量寄存器合并使用</li>
<li><code>SEW</code>: selected element width</li>
</ul>
<span id="more"></span>
<h2 id="控制与状态寄存器">2. 控制与状态寄存器</h2>
<p>在V向量扩展中，ISA总共定义了<strong>32个通用向量寄存器</strong>和<strong>7个CSR向量寄存器</strong></p>
<table>
<colgroup>
<col style="width: 14%">
<col style="width: 85%">
</colgroup>
<thead>
<tr>
<th>寄存器名称</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>vstart</td>
<td>向量起始地址</td>
</tr>
<tr>
<td>vxsat</td>
<td>定点数饱和标志</td>
</tr>
<tr>
<td>vxrm</td>
<td>定点数舍入模式</td>
</tr>
<tr>
<td>vcsr</td>
<td>向量控制和状态寄存器</td>
</tr>
<tr>
<td>vl</td>
<td>向量长度，每次向量操作前，都需要程序显式设置vl来确定当前向量操作的长度，对应指令<code>vset{i}vl{i}</code></td>
</tr>
<tr>
<td>vtype</td>
<td>向量数据类型</td>
</tr>
<tr>
<td>vlenb</td>
<td>向量寄存器字节宽度(VLEN / 8)</td>
</tr>
</tbody>
</table>
<ul>
<li><code>vxsat</code>寄存器是一个<strong>单比特</strong>寄存器，在定点运算中，当结果超出目标数据类型的表示范围时，<strong>饱和运算</strong>会讲运算结果阶段到数据类型的最大值或最小值而不是溢出，以避免异常值的产生。当执行指令<code>vnclip</code>或<code>vsmul</code>时发生了饱和，<code>vxsat</code>寄存器会被置1</li>
</ul>
<h2 id="向量指令">3. 向量指令</h2>
<h3 id="配置相关vsetivli">3.1 配置相关<code>vset{i}vl{i}</code></h3>
<p>以下三条指令用于快速配置<code>vl</code>寄存器和<code>vtype</code>寄存器</p>
<ul>
<li><p><code>vsetvli rd, rs1, vtypei</code></p>
<p><code>rd = new vl, rs1 = AVL, vtypei = new vtype setting</code>，该指令将最终<code>vl</code>寄存器设定的值写入<code>rd</code>寄存器中，AVL(application
vector
length)是目标向量长度，当<code>AVL &lt;= VLMAX</code>时<code>rd = AVL</code>，反之<code>rd = VLMAX</code>，同时<code>vtype</code>寄存器根据<code>vtypei</code>参数设置</p></li>
<li><p><code>vsetivli rd, uimm, vtypei</code></p>
<p>参数含义同上，AVL从立即数中获取</p></li>
<li><p><code>vsetvl rd, rs1, rs2</code></p>
<p>参数含义同上，<code>vtype</code>设置参数从寄存器中获取</p></li>
</ul>
<p>实际运用如下</p>
<figure class="highlight plaintext"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">e8  # SEW = 8b</span><br><span class="line">e16 # SEW = 16b</span><br><span class="line">e32 # SEW = 32b</span><br><span class="line">e64 # SEW = 64b</span><br><span class="line"></span><br><span class="line">mf8 # LMUL = 1/8</span><br><span class="line">mf4 # LMUL = 1/4</span><br><span class="line">mf2 # LMUL = 1/2</span><br><span class="line">m1  # LMUL = 1</span><br><span class="line">m2  # LMUL = 2</span><br><span class="line">m4  # LMUL = 4</span><br><span class="line">m8  # LMUL = 8</span><br><span class="line"></span><br><span class="line">vsetvli t0, a0, e8, ta, ma # SEW = 8, LMUL = 1</span><br><span class="line">vsetvli t0, a0, e8, m2, ta, ma # SEW = 8, LMUL = 2</span><br></pre></td></tr></tbody></table></figure>
<h3 id="浮点运算">3.2 浮点运算</h3>
<h4 id="vfcvt指令"><code>vfcvt</code>指令</h4>
<p>该指令用于<strong>单精度浮点数</strong>和<strong>有符号/无符号整数</strong>之间的转换</p>
<figure class="highlight plaintext"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">vfcvt.xu.f.v  vd, vs2, vm // 将浮点数转为无符号整数</span><br><span class="line">vfcvt.x.f.v   vd, vs2, vm // 将浮点数转为有符号整数</span><br><span class="line">vfcvt.f.xu.v  vd, vs2, vm // 将无符号整数转为浮点数</span><br><span class="line">vfcvt.f.x.v		vd, vs2, vm // 将有符号整数转为浮点数</span><br></pre></td></tr></tbody></table></figure>
<p>对应intrinsic函数为<code>__riscv_vfcvt_xu_f_v_f32m2(vint32m2_t value, size_t vl)</code>，intrinsic函数最后一个部分表示向量返回类型</p>
<h5 id="带舍入的类型转换">带舍入的类型转换</h5>
<p>根据<a href="#A">附录A</a>中的单精度浮点数舍入模式，RVV的intrinsic函数也同样支持自定义舍入模式</p>
<ul>
<li><code>__riscv_fcvt_x_f_v_i32m2_rm(vfloat32m2_t value, rm_macro, size_t vl)</code>
<ul>
<li>返回类型：<code>vint32m2_t</code></li>
<li>目的：单精度浮点类型转为32位整型，<code>rm</code>后缀表示函数中手动指定舍入模式，对应汇编指令中的动态舍入模式</li>
</ul></li>
<li><code>__riscv_fcvt_rtz_x_f_v_i32m2(vflaot32m2_t value, size_t vl)</code>
<ul>
<li>返回类型：<code>vint32m2_t</code></li>
<li>目的：将单精度浮点数转为32位整型，在函数名中显式指出使用<code>RTZ(round to zero)</code>舍入模式，对应汇编指令中的静态舍入模式</li>
</ul></li>
</ul>
<p>以上两个带舍入模式的<code>fcvt</code>内联函数各自代表F扩展中动态舍入和静态舍入模式，在函数上的差异就是是否在需要参数中指出舍入模式</p>
<h2 id="整数运算">3.3 整数运算</h2>
<h4 id="vzext指令和vsext指令"><code>vzext</code>指令和<code>vsext</code>指令</h4>
<p>这两条指令分别用于整数类型的无符号扩展和有符号扩展</p>
<figure class="highlight plaintext"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">vzext.vf2 vd, vs2, vm # 将SEW/2零扩展为SEW位宽</span><br><span class="line">vsext.vf2 vd, vs2, vm # 将SEW/2符号扩展为SEW位宽</span><br><span class="line">vzext.vf4 vd, vs2, vm</span><br><span class="line">vsext.vf4 vd, vs2, vm</span><br><span class="line">vzext.vf8 vd, vs2, vm</span><br><span class="line">vsext.vf8 vd, vs2, vm</span><br></pre></td></tr></tbody></table></figure>
<p>对应intrinsic函数有<code>__riscv_vzext_vf4_i32m2(vint8m2_t value, size_t vl)</code></p>
<h3 id="定点运算">3.4 定点运算</h3>
<h4 id="vnclip指令和vnclipu指令"><code>vnclip</code>指令和<code>vnclipu</code>指令</h4>
<p>两条指令都通过将向量元素右移的方式来裁剪舍入定点数的大小，而两条指令的差别就是算数右移和逻辑右移</p>
<figure class="highlight plaintext"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">vnclip.wv vd, vs2, vs1, vm # 算数右移 vd[i] = clip(roundoff_unsigned(vs2[i], vs[i]))</span><br><span class="line">vnclip.wx vd, vs2, rs1, vm</span><br><span class="line">vnclip.wi vd, vs2, rs1, vm</span><br><span class="line">vnclipu.wv vd, vs2, vs1, vm</span><br><span class="line">vnclipu.wx vd, vs2, rs1, vm</span><br><span class="line">vnclipu.wi vd, vs2, uimm, vm</span><br></pre></td></tr></tbody></table></figure>
<h2 id="内联函数">4. 内联函数</h2>
<p>rvv intrinsic
function是一种由编译器提供的函数借口，该类函数用于将rvv底层复杂的向量汇编指令以更加直观和C适配的方式向上提供接口，其函数命名规则符合规律<code>__riscv_指令_指令后缀_返回类型+LMUL</code>。大多数内联函数都能和向量指令集中的每一条向量一一对应，部分内联函数具有独立含义，不关联于底层向量指令</p>
<ul>
<li><code>__riscv_vlmul_trunc_v_u8m2_u8fm2(vuint8m2_t value)</code>
<ul>
<li>返回类型：<code>vuint8fm2_t</code></li>
<li>目的：裁切<code>vuint8m2_t</code>类型的寄存器组，截取前<code>fm2</code>部分的元素放在新的向量寄存器组并返回</li>
</ul></li>
<li><code>__riscv_vluml_ext_v_u8fm2_u8m2(vuint8mf2_t value)</code>
<ul>
<li>返回类型：<code>vuint8m2_t</code></li>
<li>目的：扩展<code>vuint8mf2</code>的寄存器组</li>
</ul></li>
</ul>
<h2>
<span id="A">附录A 单精度浮点舍入模式</span>
</h2>
<p>在RISCV的F扩展中，有单精度浮点控制和状态寄存器<code>fcsr</code>，该寄存器中<code>5~7</code>共三位的为<code>frm</code>字段，用于控制部分浮点指令动态舍入模式。一个浮点指令的执行要么使用静态舍入模式，要么使用动态舍入模式(从frm字段获取)，当一条浮点指令的<code>rm</code>字段设置为<code>DYN(111)</code>时，表示该指令采用动态舍入模式，其舍入方法将从<code>fcsr</code>寄存器的<code>frm</code>字段获取，而<code>rm</code>字段的其他值含义如下</p>
<table>
<thead>
<tr>
<th>Rounding Mode</th>
<th>Mnemonic</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>000</td>
<td>RNE</td>
<td>尽量舍入到最近的偶数</td>
</tr>
<tr>
<td>001</td>
<td>RTZ</td>
<td>向0舍入</td>
</tr>
<tr>
<td>010</td>
<td>RDN</td>
<td>向下舍入，向负无穷</td>
</tr>
<tr>
<td>011</td>
<td>RUP</td>
<td>向上舍入，向正无穷</td>
</tr>
<tr>
<td>100</td>
<td>RMM</td>
<td>尽量舍入到最近的绝对值最大的数</td>
</tr>
<tr>
<td>101</td>
<td></td>
<td>保留</td>
</tr>
<tr>
<td>110</td>
<td></td>
<td>保留</td>
</tr>
<tr>
<td>111</td>
<td>DYN</td>
<td>动态舍入模式，读取<code>frm</code>字段</td>
</tr>
</tbody>
</table>

    </div>

    
    
    

      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/tags/RISCV/" rel="tag"><i class="fa fa-tag"></i> RISCV</a>
              <a href="/tags/%E5%B9%B6%E8%A1%8C%E8%AE%A1%E7%AE%97/" rel="tag"><i class="fa fa-tag"></i> 并行计算</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2024/08/05/%E5%8D%8A%E7%B2%BE%E5%BA%A6-%E5%8D%95%E7%B2%BE%E5%BA%A6%E6%B5%AE%E7%82%B9%E6%95%B0%E8%BD%AC%E5%8C%96/" rel="prev" title="半精度/单精度浮点数转化">
      <i class="fa fa-chevron-left"></i> 半精度/单精度浮点数转化
    </a></div>
      <div class="post-nav-item">
    <a href="/2024/08/16/cuda%E7%BC%96%E7%A8%8B/" rel="next" title="cuda编程">
      cuda编程 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%B8%93%E6%9C%89%E5%90%8D%E8%AF%8Dprofessional-shortcut"><span class="nav-number">1.</span> <span class="nav-text">1. 专有名词(Professional
Shortcut)</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%8E%A7%E5%88%B6%E4%B8%8E%E7%8A%B6%E6%80%81%E5%AF%84%E5%AD%98%E5%99%A8"><span class="nav-number">2.</span> <span class="nav-text">2. 控制与状态寄存器</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%90%91%E9%87%8F%E6%8C%87%E4%BB%A4"><span class="nav-number">3.</span> <span class="nav-text">3. 向量指令</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%85%8D%E7%BD%AE%E7%9B%B8%E5%85%B3vsetivli"><span class="nav-number">3.1.</span> <span class="nav-text">3.1 配置相关vset{i}vl{i}</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%B5%AE%E7%82%B9%E8%BF%90%E7%AE%97"><span class="nav-number">3.2.</span> <span class="nav-text">3.2 浮点运算</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#vfcvt%E6%8C%87%E4%BB%A4"><span class="nav-number">3.2.1.</span> <span class="nav-text">vfcvt指令</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#%E5%B8%A6%E8%88%8D%E5%85%A5%E7%9A%84%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2"><span class="nav-number">3.2.1.1.</span> <span class="nav-text">带舍入的类型转换</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%95%B4%E6%95%B0%E8%BF%90%E7%AE%97"><span class="nav-number">4.</span> <span class="nav-text">3.3 整数运算</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#vzext%E6%8C%87%E4%BB%A4%E5%92%8Cvsext%E6%8C%87%E4%BB%A4"><span class="nav-number">4.0.1.</span> <span class="nav-text">vzext指令和vsext指令</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%9A%E7%82%B9%E8%BF%90%E7%AE%97"><span class="nav-number">4.1.</span> <span class="nav-text">3.4 定点运算</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#vnclip%E6%8C%87%E4%BB%A4%E5%92%8Cvnclipu%E6%8C%87%E4%BB%A4"><span class="nav-number">4.1.1.</span> <span class="nav-text">vnclip指令和vnclipu指令</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%86%85%E8%81%94%E5%87%BD%E6%95%B0"><span class="nav-number">5.</span> <span class="nav-text">4. 内联函数</span></a></li><li class="nav-item nav-level-2"><a class="nav-link"><span class="nav-number">6.</span> <span class="nav-text">
附录A 单精度浮点舍入模式
</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Benson"
      src="/images/ME.ico">
  <p class="site-author-name" itemprop="name">Benson</p>
  <div class="site-description" itemprop="description">Share my thoughts with you</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">17</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">25</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/ZhouBencheng" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;ZhouBencheng" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:zhoubencheng2022@163.com" title="E-Mail → mailto:zhoubencheng2022@163.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Benson</span>
</div>

<!--
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>
-->

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>


  <script defer src="/lib/three/three.min.js"></script>
    <script defer src="/lib/three/canvas_lines.min.js"></script>


  













<script>
if (document.querySelectorAll('pre.mermaid').length) {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js', () => {
    mermaid.initialize({
      theme    : 'dark',
      logLevel : 3,
      flowchart: { curve     : 'linear' },
      gantt    : { axisFormat: '%m/%d/%Y' },
      sequence : { actorMargin: 50 }
    });
  }, window.mermaid);
}
</script>


  

  

  

</body>
</html>
